package com.evon.yardmanagement.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.AttributeOverride;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name ="OEM")
@Access(AccessType.FIELD)
@AttributeOverride( name="id", column = @Column(name="OEM_ID") )
public class Oem extends BaseModel implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
		
	
	@Column(name = "OEM_NAME")
	private String name;
	
	@Column(name = "ADDRESS")
	private String address;
	
	@Column(name = "CITY")
	private String city;
	
	@Column(name = "PHONE")
	private String phone;
	
	@OneToMany(fetch=FetchType.LAZY, targetEntity = Yard.class)
	  @JoinTable(name = "YARD_MAPPING",
	    joinColumns = {
	      @JoinColumn(name="OEM_ID" , unique = true)           
	    },
	    inverseJoinColumns = {
	      @JoinColumn(name="YARD_ID")
	    }
	  )
	private List<Yard> yards;
	
	@ManyToOne
	@JoinColumn(name = "STATE_ID")
	private State state;
	
	@ManyToOne()
	@JoinColumn(name = "VENDOR_ID")
	private Vendor vendor;
	
	@Column(name="EMAIL_ID")
	private String emailId;
	
	@Column(name="CONTACT_PERSON")
	private String contactPerson;
	
	@Column(name="ZIP_CODE")
	private String zipCode;
	
	@Column(name="STATUS")
	private boolean status;

	public List<Yard> getYards() {
		return yards;
	}

	public void setYards(List<Yard> yards) {
		this.yards = yards;
	}

	

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	public Vendor getVendor() {
		return vendor;
	}

	public void setVendor(Vendor vendor) {
		this.vendor = vendor;
	}

	public String getEmailId() {
		return emailId;
	}

	public void setEmailId(String emailId) {
		this.emailId = emailId;
	}

	public String getContactPerson() {
		return contactPerson;
	}

	public void setContactPerson(String contactPerson) {
		this.contactPerson = contactPerson;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public boolean isStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}
	
	
}
